package day1;

import java.io.Serializable;

/**
 * @author oldliu
 * @since 1.0
 */
public final class Dog extends Pet implements Serializable {

    private String brain;//品种
    public Dog(){

    }
    public Dog(String name, int h, int l, String b){

        super(name,h,l);//super：在子类中指代父类
//        setName(name);
//        setLove(l);
//        setHealth(h);
        this.brain=b;
        //>>>super.name=name;
    }
    public Dog(int h, int l, String brain){
        super(h,l);
        this.brain=brain;//

        System.out.println("这是三个参数的构造方法");
    }
    private Dog(String name,String brain){
        super(name,0,0);
        this.brain=brain;//

        System.out.println("这是2个参数的构造方法");
    }
    public void print(){
        //System.out.println("狗的名字叫"+super.getName());
        super.show();
        System.out.println("品种是"+brain);
    }
    @Override
    public void show(){
        super.show();
        System.out.println("这条狗的品种是："+brain);
    }
    public String getBrain() {
        return brain;
    }

    public void setBrain(String brain) {
        this.brain = brain;
    }

//    public void catchMouse(Mouse m){
//        System.out.println(super.name+"抓住了"+m+",大伙都说他多管闲事~！");
//    }
    @Override
    public String toString() {
        return super.toString()+"，品种是"+brain;
    }

    @Override
    public boolean equals(Object obj) {
        //比较宠物的名字
        if(!(obj instanceof Dog))
        {
            return false;
        }
        Dog d=(Dog)obj;
        return this.getName().equals(d.getName());

    }

    private boolean setHealthAndLove(int h,int l){
        super.setHealth(h);
        super.setLove(l);
        return true;
    }
}
